const Router = require('koa-router');

const {tokenValidator} = require('../middleware/auth.middleware');
const {videoFormValidator, idValidator} = require('../middleware/validate.middleware');
// 业务路由拆分 -- controller层
const {addVideo, updateVideo, queryVideo, queryVideoDetail, deleteVideo} = require('../controller/video.controller');

// 统一前缀
const router = new Router({prefix: '/video'});

// 增删改查
router.post('/add', tokenValidator, videoFormValidator, addVideo);
router.post('/update', tokenValidator, idValidator, videoFormValidator, updateVideo);
router.get('/list', tokenValidator, queryVideo);
router.get('/detail', tokenValidator, idValidator, queryVideoDetail);
router.post('/delete', tokenValidator, idValidator, deleteVideo);


module.exports = router;